import cv2 as cv

filename = r'C:\OpenCV\data\lena.jpg'
img = cv.imread(filename)
imgGauss = cv.GaussianBlur(img, (5, 5), 0)

# 对图像使用resize和pyrDown缩小一半再一半
image1 = cv.resize(img, (int(img.shape[1]/2), int(img.shape[0]/2)))
image2 = cv.pyrDown(image1)

# 采用彩色转灰色度并作阈值化，显示
gray = cv.cvtColor(img, cv.COLOR_RGB2BGR)
_,  gray1 = cv.threshold(gray, 120, 0xff, cv.THRESH_BINARY)

cv.imshow("source image", img)
cv.imshow("Gaussian filtered image", imgGauss)
cv.imshow("half size", image1)
cv.imshow("quarter size", image2)
cv.imshow("gray", gray)
cv.imshow("threshold.image", gray1)
cv.waitKey()
cv.destroyAllWindows()